import net.coobird.thumbnailator.Thumbnails;

import java.io.File;
import java.io.IOException;

/**
 * Created by zhangdi on 2020/11/28 10:40:20.
 */
public class app {
    public static void main(String[] args) throws IOException {
        String path = "C:\\Users\\Administrator\\Desktop\\888\\";
        File dir = new File(path);
        File[] files =  dir.listFiles();
        assert files != null;

        for (File file : files) {
            if(file.getName().indexOf("-min") > 0){
                file.delete();
                continue;
            }
            StringBuffer sb  = new StringBuffer(file.getPath());
            sb.insert(sb.toString().lastIndexOf('.'), "-min");

            Thumbnails.of(file).scale(0.3f).toFile(sb.toString());
        }
    }
}
